package bat.ke.qq.com.proxy;

import lombok.extern.slf4j.Slf4j;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 *
 */
@Slf4j
public class DynamicProxyHandler implements InvocationHandler {
    private Object target;

    public DynamicProxyHandler(Object target) {
        this.target = target;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

        Long start = System.currentTimeMillis();
        Object result = method.invoke(target, args);
        log.info("调用时间：" + (System.currentTimeMillis() - start));
        return result;
    }
}
